package metric

import (
	"htgis/monitor/common/model"
	"htgis/monitor/module/agent/util"
)

// MemMetric aggregates memory information
func MemMetric() []*model.MetricValue {
	m, err := util.MemStat()
	if err != nil {
		util.Check(err)
	}

	return []*model.MetricValue{
		GaugeValue("mem.memtotal", m.Total),
		GaugeValue("mem.memused", m.Used),
		GaugeValue("mem.memavailable", m.Available),
		GaugeValue("mem.memused.percent", m.UsedPercent),
	}
}
